import 'package:flutter_app/model/user.dart';
import 'package:meta/meta.dart';

class UserState {
  User _user;

  get user => _user;

  UserState(this._user);

  UserState.initState() {
    _user = null;
  }
}

//enum Action { increment }

//reducer是我们的状态生成器，它接收一个我们原来的状态，然后接收一个action，再匹配这个action生成一个新的状态。
UserState reducer(UserState state, action) {
  //匹配Action
  /*if (action == Action.increment) {
    return UserState(state.user);
  }*/
  if (action is User) {
    return UserState(action);
  }

  return state;
}
